home *** CD-ROM | disk | FTP | other *** search
- (*********************************************************************)
- (* Note: In order to use this file as an include file in a Turbo *)
- (* Pascal program you would add this line to your main program: *)
- (* {$I CURSOR.INC} *)
- (* (or whatever name you choose for the include file) prior to *)
- (* calling any of the functions or procedures. *)
- (*********************************************************************)
-
- (*Include file CURSOR.INC; {Version 1.0}
- {This file contains cursor related ROM BIOS 8088 software interrupt
- functions and procedures for inclusion in other programs and are
- written in Turbo Pascal, version 3.01, MS-DOS/PC-DOS implementation for
- the IBM PC. All parameters pass to and from the BIOS routines through
- the 8088 registers. The interface between Pascal and the 8088 is through
- the variable 'Result' which is of type 'registers'. The type 'registers'
- and the variable 'Result' must be declared as globals in the main program
- as well as the other types listed below. These functions and procedures
- were compiled by George E. Noel, Route 2 Box 75, Crookston, MN, 56716 in
- March of 1985 and are public domain.}
-
- type {global type}
- registers = record
- AX,BX,CX,DX,BP,SI,DI,DS,ES,Flags: integer;
- end;
-
- var {global variable}
- Result: registers;*)
-
- (****************************************************************************)
- (* DISPLAY I/O SUPPORT INTERRUPTS *)
- (****************************************************************************)
-
- procedure SetCursorType (StartLine, EndLine: byte);
- {This procedure sets the start and end lines for the cursor. The passed
- values must not exceed 31 to avoid erratic blinking or no cursor at all.
- If the start line is after the end line, no cursor will be displayed.
- The maximun scan line for the monochrome is 13. If the start line is set
- to 14 or higher, no cursor will be displayed.}
-
- const
- InterruptNumber = $10; {BIOS interrupt VIDEO_IO}
-
- var
- AH, AL, CH, CL: byte; {accumulator register - high byte, low byte}
- {count register - high byte, low byte}
-
- begin
- with Result do {using the global variable of type regesters}
- begin
- AH := 1; {indicate the desired operation in the high byte}
- AX := AH shl 8 + AL; {then place high byte in the accumulator}
- CH := StartLine; {set high counter to start line for cursor}
- CL := EndLine; {set low counter to end line for cursor}
- CX := CH shl 8 + CL; {then place both bytes in the counter}
- intr(InterruptNumber,Result); {pre-declared turbo function}
- end;
- end; {end of procedure SetCursorType}
-
- (****************************************************************************)
-
- function CursorType: integer;
- {This function gets the current cursor mode and returns it as an integer
- in the same format as the CX register. The CH register contains the
- start of the cursor line and the CL register contains the end.}
-
- const
- InterruptNumber = $10; {BIOS interrupt KEYBOARD_IO}
-
- var
- AH,AL: byte; {accumulator register - high byte, low byte}
-
- begin
- with Result do {using the global variable of type regesters}
- begin
- AH := 3; {indicate the desired operation in the high byte}
- AX := AH shl 8 + AL; {then place high byte in the accumulator}
- intr(InterruptNumber,Result); {pre-declared turbo function}
- CursorType := CX; {assign value to function designator}
- end;
- end; {end of function CursorType}
-
- (****************************************************************************)
-
- procedure SetCursorPosition (Row, Column, Page: byte);
- {This procedure positions the cursor on the passed page number (0-7 for
- modes 0 & 1, 0-3 for modes 2 & 3.) at the passed row and column. The
- page number must be zero for the graphics modes. The upper left corner
- is (row,column) - (0,0).}
-
- const
- InterruptNumber = $10; {BIOS interrupt VIDEO_IO}
-
- var
- AH, AL, {accumulator register - high byte, low byte}
- DH, DL, BH, BL: byte; {date register - high byte, low byte}
- {base register - high byte, low byte}
-
- begin
- with Result do {using the global variable of type regesters}
- begin
- AH := 2; {indicate the desired operation in the high byte}
- AX := AH shl 8 + AL; {then place high byte in the accumulator}
- DH := Row; {set the high data register to the cursor row}
- DL := Column; {set the low data register to the cursor column}
- DX := DH shl 8 + DL; {then place both bytes in the register}
- BH := Page; {set the high base register to the page number}
- BX := BH shl 8 + BL; {then place high byte in the register}
- intr(InterruptNumber,Result); {pre-declared turbo function}
- end;
- end; {end of procedure SetCursorPosition}
-
- (****************************************************************************)
-
- function CursorPosition (Page: byte): integer;
- {This function returns the position of the cursor on the passed page
- number. (0-7 for modes 0 & 1, 0-3 for modes 2 & 3. The page number must
- be zero for the graphics modes.) The value returned is an integer
- ranging from 0 (the upper left hand corner of the screen) to 1999 (the
- lower right corner). The row can be calculated by row = value div 80.
- The column can be calculated by column = value mod 80. The upper left
- corner would then be (0,0).}
-
- const
- InterruptNumber = $10; {BIOS interrupt VIDEO_IO}
-
- var
- AH, AL, BH, BL: byte; {accumulator register - high byte, low byte}
- {base register - high byte, low byte}
-
- begin
- with Result do {using the global variable of type regesters}
- begin
- AH := 3; {indicate the desired operation in the high byte}
- AX := AH shl 8 + AL; {then place high byte in the accumulator}
- BH := Page; {set the high base register to the page number}
- BX := BH shl 8 + BL; {then place high byte in the register}
- intr(InterruptNumber,Result); {pre-declared turbo function}
- CursorPosition := ((DX shr 8 * 80) + (DX mod 256));
- {cursor position as row number times 80 plus column number}
- end;
- end; {end of procedure SetCursorPosition}
-
- (****************************************************************************)
-
- procedure CursorOff;
- {This procedure uses the procedure SetCursorType to turn the cursor off on
- a monochrome display.}
-
- begin
- SetCursorType (15,0);
-
- end;
-
- (****************************************************************************)
-
- procedure CursorOn;
- {This procedure uses the procedure SetCursorType to set the cursor to its
- maximun height on a monochrome display.}
-
- begin
- SetCursorType (0,13);
-
- end;
-
- (****************************************************************************)
-
- procedure CursorNorm;
- {This procedure uses the procedure SetCursorType to set the cursor to its
- normal appearance on a monochrome display.}
-
- begin
- SetCursorType (12,13);
-
- end;
-
- (****************************************************************************)
- {end of include file CURSOR.INC}
-
-
-